{{include_file name='public/header' title='环境检测——安装步骤一'}}
<link href="{{STATIC_URL}}/css/install.css" rel="stylesheet">

</head>

<body>

    <div class="container">
        <div class="row">
            <div class="col-md-10 col-md-offset-1">
                <div class="install-panel panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title text-center">安装步骤一</h3>
                    </div>
                    <div class="panel-body">

                        {{include_file name='public/nav' step=1}}
                        <form id="js_step1Form" role="form" action="{{url('install/step1')}}" method="post">
                        <div class="row">
                            <div class="col-lg-12">
                                <div class="panel panel-default">
                                    <div class="panel-heading">
                                        系统环境检测
                                    </div>
                                    <div class="panel-body">
                                        <div class="table-responsive">
                                            <table class="table table-bordered">
                                                <thead>
                                                <tr>
                                                    <th>检查项目</th>
                                                    <th>当前配置</th>
                                                    <th>所需配置</th>
                                                    <th>检测结果</th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                <tr>
                                                    <td>操作系统</td>
                                                    <td>{{$system.php_os}}</td>
                                                    <td>Linux</td>
                                                    <td><i class="fa fa-check"></i></td>
                                                </tr>
                                                <tr>
                                                    <td>PHP版本</td>
                                                    <td>{{$system.php_version}}</td>
                                                    <td>>=5.4.0</td>
                                                    <td>
                                                        {{if version_compare( $system.php_version, '5.4.0', '>=' )}}
                                                        <i class="fa fa-check"></i>
                                                        {{else}}
                                                        <i class="fa fa-times"></i>
                                                        <input type="hidden" name="step1['php_version']" value="当前PHP版本不符合要求" >
                                                        {{/if}}
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>MySQL版本</td>
                                                    <td>{{$system.mysql_version}}</td>
                                                    <td>>=5.1.0</td>
                                                    <td>
                                                        {{if version_compare( $system.mysql_version, '5.1.0', '>=' )}}
                                                        <i class="fa fa-check"></i>
                                                        {{else}}
                                                        <i class="fa fa-times"></i>
                                                        <input type="hidden" name="step1['mysql_version']" value="当前MySQL版本不符合要求" >
                                                        {{/if}}
                                                    </td>
                                                </tr>

                                                </tbody>
                                            </table>
                                        </div>

                                    </div>

                                </div>
                            </div>

                            <div class="col-lg-12">
                                <div class="panel panel-default">
                                    <div class="panel-heading">
                                        依赖性检测
                                    </div>
                                    <div class="panel-body">
                                        <div class="table-responsive">
                                            <table class="table table-bordered">
                                                <thead>
                                                <tr>
                                                    <th>检查项目</th>
                                                    <th>当前配置</th>
                                                    <th>所需配置</th>
                                                    <th>检测结果</th>
                                                </tr>
                                                </thead>
                                                <tbody>

                                                <tr>
                                                    <td>PDO扩展</td>
                                                    <td>{{if class_exists('pdo')}}支持{{else}}不支持{{/if}}</td>
                                                    <td>支持</td>
                                                    <td>
                                                        {{if class_exists('pdo')}}
                                                        <i class="fa fa-check"></i>
                                                        {{else}}
                                                        <i class="fa fa-times"></i>
                                                        <input type="hidden" name="step1['pdo']" value="必须安装PDO扩展" >
                                                        {{/if}}
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>GD扩展</td>
                                                    <td>
                                                        {{if function_exists('imagecreate')}}
                                                        支持
                                                        {{else}}
                                                        不支持
                                                        {{/if}}
                                                    </td>
                                                    <td>支持</td>
                                                    <td>
                                                        {{if function_exists('imagecreate')}}
                                                        <i class="fa fa-check"></i>
                                                        {{else}}
                                                        <i class="fa fa-times"></i>
                                                        <input type="hidden" name="step1['gd']" value="必须安装GD扩展" >
                                                        {{/if}}
                                                    </td>
                                                </tr>

                                                <tr>
                                                    <td>MCRYPT扩展</td>
                                                    <td>
                                                        {{if extension_loaded('mcrypt')}}
                                                        支持
                                                        {{else}}
                                                        不支持
                                                        {{/if}}
                                                    </td>
                                                    <td>支持</td>
                                                    <td>
                                                        {{if extension_loaded('mcrypt')}}
                                                        <i class="fa fa-check"></i>
                                                        {{else}}
                                                        <i class="fa fa-times"></i>
                                                        <input type="hidden" name="step1['mcrypt']" value="必须安装MCRYPT扩展" >
                                                        {{/if}}
                                                    </td>
                                                </tr>

                                                </tbody>
                                            </table>
                                        </div>

                                    </div>

                                </div>
                            </div>

                            <div class="col-lg-12">
                                <div class="panel panel-default">
                                    <div class="panel-heading">
                                        目录权限检测
                                    </div>
                                    <div class="panel-body">
                                        <div class="table-responsive">
                                            <table class="table table-bordered">
                                                <thead>
                                                <tr>
                                                    <th>检查项目</th>
                                                    <th>当前权限</th>
                                                    <th>所需权限</th>
                                                    <th>检测结果</th>
                                                </tr>
                                                </thead>
                                                <tbody>

                                                <tr>
                                                    <td>runtime</td>
                                                    <td>{{$chmod['runtime']}}</td>
                                                    <td>可读,可写</td>
                                                    <td>
                                                        {{if is_writable(RUNTIME_PATH)}}
                                                        <i class="fa fa-check"></i>
                                                        {{else}}
                                                        <i class="fa fa-times"></i>
                                                        <input type="hidden" name="step1[log]" value="runtime目录必须可写" >
                                                        {{/if}}
                                                    </td>
                                                </tr>

                                                <tr>
                                                    <td>runtime/comlile</td>
                                                    <td>{{$chmod['compile']}}</td>
                                                    <td>可读,可写</td>
                                                    <td>
                                                        {{if is_writable(RUNTIME_PATH|cat:'/compile')}}
                                                        <i class="fa fa-check"></i>
                                                        {{else}}
                                                        <i class="fa fa-times"></i>
                                                        <input type="hidden" name="step1[db]" value="runtime/comlile目录必须可读可写" >
                                                        {{/if}}
                                                    </td>
                                                </tr>

                                                <tr>
                                                    <td>runtime/config</td>
                                                    <td>{{$chmod['config']}}</td>
                                                    <td>可读,可写</td>
                                                    <td>
                                                        {{if is_writable(RUNTIME_PATH|cat:'/config')}}
                                                        <i class="fa fa-check"></i>
                                                        {{else}}
                                                        <i class="fa fa-times"></i>
                                                        <input type="hidden" name="step1[db]" value="runtime/config目录必须可读可写" >
                                                        {{/if}}
                                                    </td>
                                                </tr>

                                                <tr>
                                                    <td>runtime/log</td>
                                                    <td>{{$chmod['log']}}</td>
                                                    <td>可读,可写</td>
                                                    <td>
                                                        {{if is_writable(RUNTIME_PATH|cat:'/log/')}}
                                                        <i class="fa fa-check"></i>
                                                        {{else}}
                                                        <i class="fa fa-times"></i>
                                                        <input type="hidden" name="step1[install]" value="runtime/log目录必须可读可写" >
                                                        {{/if}}
                                                    </td>
                                                </tr>

                                                </tbody>
                                            </table>
                                        </div>
                                        <div class="panel-button form-group text-center">
                                            <button type="button" class="btn btn-info js_submit">下一步</button>
                                        </div>

                                    </div>

                                </div>
                            </div>

                        </div>
                        </form>
                    </div>

                </div>
            </div>
        </div>

    </div>
    <script>

        $(function(){

            //验证登录表单
            $("#js_step1Form").Validform({

                tiptype:function(msg,o,cssctl){

                    if(!o.obj.is("form")){

                        var objtip=o.obj.siblings(".Validform_checktip");

                        cssctl(objtip,o.type);

                        objtip.text(msg);

                    }

                },

                label:"label",

                ajaxPost:true,

                btnSubmit: '.js_submit',

                callback:function(json){

                    if(json.code == 200){

                        window.location.href = "{{url('install/step2')}}";

                    }else{

                        alert(json.msg, 2000);

                    }

                }

            });


        })

    </script>
    {{include_file name='public/footer'}}
